#ifndef IMAGELABEL_H
#define IMAGELABEL_H

#include <QLabel>

class ImageLabel : public QLabel
{
    Q_OBJECT
public:
    explicit ImageLabel(QWidget *parent = 0);

    void setPixmap(const QPixmap &pixmap);
    QPixmap pixmap() const { return p; }
    QString getFileName() const { return file; }

signals:
    void labelPressed(ImageLabel *label);
    void labelActived(ImageLabel *label);

public slots:
    void setActive(bool yes) { setFrameStyle(yes?QFrame::Sunken:QFrame::Plain); }
    void setImageSize(const QSize &size);
    void setImageSize(int width, int height) { setImageSize(QSize(width, height)); }
    void setFileName(const QString &fileName) { file = fileName; }

protected:
    void mousePressEvent(QMouseEvent *e);
    void mouseDoubleClickEvent(QMouseEvent *e);

    QPixmap p;
    QString file;
};

#endif // IMAGELABEL_H
